namespace ZFramework.Runtime
{
    public partial class ItemMgr
    {
        private class ItemInfo : IReference
        {
            private Item _item;
            private ItemStatus _status;

            public ItemInfo()
            {
                _item = null;
                _status = ItemStatus.WillInit;
            }

            public Item Item => _item;

            public ItemStatus Status
            {
                get => _status;
                set => _status = value;
            }

            public static ItemInfo Create(Item item)
            {
                var itemInfo = ReferencePool.Acquire<ItemInfo>();
                itemInfo._item = item;
                itemInfo._status = ItemStatus.WillInit;
                return itemInfo;
            }

            public void Clear()
            {
                _item = null;
                _status = ItemStatus.Unknown;
            }
        }
    }
}
